package cn.edu.dutir.indri;

import lemurproject.lemur.Index;
import lemurproject.lemur.IndexManager;

public class LemurRetreival {
	public static void main(String[] args) {
		// we assume the index path is the first argument
		String indexPath = "d:/CWT200g_url2docno_index";
		try {
			// open the index10.
			Index theIndex = IndexManager.openIndex(indexPath);
			// get the count of documents
			int numDocuments = theIndex.docCount();
			// get the average document length (in words)
			float avgDocLength = theIndex.docLengthAvg();
			// get the count of total terms
			int totalTermCount = theIndex.termCount();
			// get the count of _unique_ terms
			int uniqueTermCount = theIndex.termCountUnique();
			// print out our statistics
			System.out.println("# documents: " + numDocuments);
			System.out.println("Avg. Document Length: " + avgDocLength);
			System.out.println("# terms: " + totalTermCount);
			System.out.println("# unique terms: " + uniqueTermCount);
			// when theIndex goes out of scope, it will be closed
			// and disposed of.
		} catch (Exception e) {
			System.out.println("Exception was thrown: " + e.getMessage());
		}
	}

	public static void buildIndex() {

	}
}
